@namespace DevToys.Blazor.Components

@inherits JSStyledComponentBase

<CascadingValue Name="ParentIsEnabled" Value="@IsActuallyEnabled">
    <Container HorizontalAlignment="@HorizontalAlignment"
               VerticalAlignment="@VerticalAlignment"
               Width="@Width"
               Height="@Height"
               MarginLeft="@MarginLeft"
               MarginRight="@MarginRight"
               MarginTop="@MarginTop"
               MarginBottom="@MarginBottom"
               PaddingLeft="@PaddingLeft"
               PaddingRight="@PaddingRight"
               PaddingTop="@PaddingTop"
               PaddingBottom="@PaddingBottom"
               IsEnabled="@IsActuallyEnabled"
               IsVisible="@IsVisible">
        <label id=@Id
               class="radio-button-container @(IsActuallyEnabled ? string.Empty : "disabled")"
               style="@(Style)"
               @onclick:stopPropagation="@IsActuallyEnabled"
               @ref=Element>
            <input type="radio"
                   tabindex="0"
                   class="radio-button @(FinalCssClasses)"
                   checked="@IsChecked"
                   disabled="@(!IsActuallyEnabled)"
                   name="@Group"
                   @onclick:preventDefault="@(!IsActuallyEnabled)"
                   @onkeydown:stopPropagation="@IsActuallyEnabled"
                   @onchange="OnChange"
                   @attributes="AdditionalAttributes" />
            <TextBlock Text="@Text" />
        </label>
    </Container>
</CascadingValue>